package com.woniuxy.stage3demo.service.gy.Impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.stage3demo.bean.gy.OverdueBean;
import com.woniuxy.stage3demo.bean.gy.UserDemo;
import com.woniuxy.stage3demo.bean.hpxbean.OrderBean;
import com.woniuxy.stage3demo.mapper.gy.OverdueOrderMapper;
import com.woniuxy.stage3demo.service.gy.OverdueOrderService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;

/**
 * @author ：苟杨
 * @description：TODO
 * @date ：2020/12/10 14:15
 */
@Transactional(readOnly = true)
@Service
public class OverdueOrderServiceImpl implements OverdueOrderService {
    @Resource
    private OverdueOrderMapper overdueorderMapper;
    //根据订单ID查询订单详情(借款金额、产品、期限、利率)
    @Override
    public OrderBean findById(Integer id) {
        return overdueorderMapper.findById(id);
    }
    //根据订单的状态来查询需要提醒还款的人数
    @Override
    public PageInfo<OverdueBean> findByStatus(int pageNum, int pageSize, UserDemo userDemo) {
        return PageHelper.startPage(pageNum,pageSize).doSelectPageInfo(()->overdueorderMapper.findByStatus(userDemo));
    }
    //查询本月还款用户数
    @Override
    public int findCount() {
        return overdueorderMapper.findCount();
    }
    //查询本年还款用户数
    @Override
    public int findCountYear() {
        return overdueorderMapper.findCountYear();
    }
    //查询本月的还款总金额
    @Override
    public List<Long> findCountMoney() {
        return overdueorderMapper.findCountMoney();
    }

    //查询本年的还款总金额
    @Override
    public List<Long> findCountMoneyYear() {
        return overdueorderMapper.findCountMoneyYear();
    }


}
